package learnjava.basic.other;

public abstract class Animal {

    public static void main(String[] args) {
        Cat cat = new Cat();
        cat.eat();
        cat.method1();
    }

    //当一个类中存在抽象方法时，需要把该类设为抽象类
    public abstract void eat();

    public void method1(){
        System.out.println("这是一个动物");
    }
}

class Cat extends Animal{
    @Override
    public void eat() {
        System.out.println("猫吃鱼");
    }
}
